<?php
namespace app\merchant\controller;

use tp5_lib\common\controller\TestBaseController;
use app\merchant\model\MerchantModel;

class TestController extends TestBaseController
{
    public function index()
    {
        return $this->fetch();
    }
    public function audit()
    {
        if(!$id=input("id")){
            $this->error("ID不能为空");
        }
        $model=new MerchantModel();
        if(!$record=$model->db()->where(["id"=>$id])->find()){
            $this->error("查找不到");
        }
        $status = input("pass") ? 1 : 2;
        if(!$model->db()->where(["id"=>$id])->setField("status",$status)){
            $this->error("更新失败");
        }
        $this->success();
    }
}
